home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Belgian Amiga Club - ADF Collection
/
BS1 part 34.zip
/
BS1 part 34
/
megadisc PD 14.adf
/
PROGRAMS
/
AREXX
/
Apropos.rexx
< prev
next >
Wrap
OS/2 REXX Batch file
|
1989-12-11
|
2KB
|
57 lines
/* UNIX-like `apropos' command to search for documentation */
arg arg1 arg2 arg3 arg4 /* parse the command line arguments */
if arg1 = '-D' then ; do /* we have been given a doc path */
if arg4 ~= '' then ; do
say 'apropos: too many arguments'
exit 5
end
if arg2 = '' then ; do
say 'apropos: missing documentation path'
exit 5
end
if arg3 = '' then ; do
say 'apropos: missing search key'
exit 5
end
rt = right( arg2, 1 ) /* Get the doc path into the form */
if rt ~= ':' & rt ~= '/' then /* we want; pathname followed by */
docpath = arg2'/' /* either a ':' or a '/', as */
else /* appropriate. */
docpath = arg2
searchkey = arg3
end
else ; do /* we should only have a keyword */
if arg2 ~= '' then ; do
say 'apropos: too many arguments'
exit 5
end
if arg1 = '' then ; do
say 'Usage: apropos [-d <DocPath>] <SearchKey>'
exit 0
end
docpath = 'DOC:'
searchkey = arg1
end
if exists( docpath'doc.index' ) then ; do
address command
tempfile = 'T:'searchkey'_apropos.tmp'
'search >'tempfile docpath'doc.index' ' 'searchkey' ' nonum
parse value statef( tempfile ) with . len . /* find length of output */
if len = 0 then /* no output was generated */
say 'Nothing appropriate ...'
else
'type' tempfile /* display all the matches */
'delete' tempfile
exit 0
end
else ; do
say 'apropos: could not find index file'
exit 10
end